with open("guest.txt","w",encoding="utf-8",buffering=1) as f:
    while 1:
        b = input("输入1继续，输入其他退出：")
        if int(b) == 1:
            name1 = input("请输入姓名：")
            name2 = f"{name1}{a}\n"
            f.write(name2)
            print("输入成功")
        else:
            break
